
package puan.com.weighBox;


import androidx.annotation.IntDef;

/**
 * Created by Jason on 2017/5/11.
 */

public class MainEvent<T> {
    //先定义 常量

    public static final int DO_SCAN_BLUETOOTH = 1; //扫描蓝牙
    public static final int NOTIFY_BLUETOOTH_LIST = 2; //刷新蓝牙列表
    public static final int DO_CONNECT_BLUETOOTH = 3; //连接蓝牙
    public static final int DO_SEND_DATA = 4;//发送数据
    public static final int DO_CONNECT_BLUETOOTH_SUCCESS = 5; //蓝牙连接成功
    // 声明构造器
    @IntDef({
            DO_SCAN_BLUETOOTH, NOTIFY_BLUETOOTH_LIST, DO_CONNECT_BLUETOOTH, DO_SEND_DATA,DO_CONNECT_BLUETOOTH_SUCCESS
    })

    // 自定义注释
    public @interface Code {

    }

    private int code;
    private T value;

    public MainEvent(@Code int code) {
        this.code = code;
    }

    public MainEvent(@Code int code, T value) {
        this.code = code;
        this.value = value;
    }

    public int getCode() {
        return code;
    }

    public void setCode(@Code int code) {
        this.code = code;
    }

    public T getValue() {
        return value;
    }

    public void setValue(T value) {
        this.value = value;
    }


}

